package com.wxq.yaoxia.drug;


import com.wxq.yaoxia.YXBaseSearchResultActivity;
import com.wxq.yaoxia.util.YXConstants;
import android.content.Intent;
import android.database.Cursor;
import android.util.Log;

public class YXDrugSearchResultActivity extends YXBaseSearchResultActivity{

	@Override
	public void setLVItemClickAction(int position) {
		// 选中某项之后的操作。
		cursor.moveToPosition(position);
		Intent newIntent = new Intent();
		newIntent.putExtra(YXConstants.KEY_ID, cursor.getLong(cursor.getColumnIndex(YXConstants.KEY_ID)));
		newIntent.putExtra(YXConstants.COLUMN_Name, cursor.getString(cursor.getColumnIndex(YXConstants.COLUMN_Name)));
		newIntent.putExtra(YXConstants.DRUG_COLUMN_BrandName, cursor.getString(cursor.getColumnIndex(YXConstants.DRUG_COLUMN_BrandName)));
		newIntent.putExtra(YXConstants.DRUG_COLUMN_CommonName, cursor.getString(cursor.getColumnIndex(YXConstants.DRUG_COLUMN_CommonName)));
		newIntent.putExtra(YXConstants.COLUMN_QueryId, cursor.getString(cursor.getColumnIndex(YXConstants.COLUMN_QueryId)));
		newIntent.setClass(YXDrugSearchResultActivity.this, YXDrugDetailActivity.class);
		startActivity(newIntent);		
	}

	@Override
	public Cursor getDoSearchCursor(String queryString) {
		// 点击搜索按钮的数据
		Log.d("wxq", "开始搜索药品："+queryString);
		return dbHelper.getDrugsWithName(queryString);
	}

	@Override
	public Cursor getDoDefaultCursor(String queryString) {
		// 其他直接点击进入的 类似药物
		return dbHelper.getDrugsWithQueryId(queryString);
	}

	@Override
	public Cursor getCheckData(String queryId) {
		// View 点击建议列表
		return dbHelper.getDrugWithID(queryId);
	}
	
	
	
}
